package com.mz.ozy.utils;

import android.util.Log;

import com.mz.ozy.BuildConfig;
import com.mz.ozy.constants.Constants;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Map;

/**
 * @author Administrator
 * @date 2018/9/3
 * @description
 */
public class JsonUtils {
    /**
     * 线上
     *
     * @param maps
     * @return
     */
    public static String requestJsonDate(Map<String, String> maps) {
        JSONObject json = new JSONObject();

        for (String key : maps.keySet()) {
            try {
                json.put(key, maps.get(key));
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
        String planText = json.toString();
        if (BuildConfig.DEBUG) {
            Log.e("JsonUtils", planText);
        }
        String body = AESUtil.encrypt(planText, Constants.AESKEY.substring(0, 8) + Constants.AESKEY.substring(Constants.AESKEY.length() - 8));
//        String plainText = AESUtil.decrypt(body, Constants.AESKEY.substring(0, 8) + Constants.AESKEY.substring(Constants.AESKEY.length() - 8));
        return body;
    }

}
